package horse;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;

/**
 * @program: data_structures_algorithms
 * @description:
 * @author: lld
 * @create: 2020-11-20 17:00
 **/
public class Test {
    public static void main(String[] args) {
        ArrayList<Integer> list=new ArrayList<>();
        list.add(1);
        list.add(3);
        list.add(11);
        list.add(5);
        list.add(3);
//        Collections.sort(list);//升序
        list.sort(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
//                return o1-o2;//升序
                return o2-o1;//
            }
        });
        System.out.println(list);
    }
}
